#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <exception>

using namespace std;

void readData(const string & filename, vector<int> & dest);
class OpenFileError
{string errorText;
string fileName;
public:
	OpenFileError(const string et,const string fn)
	{
		errorText = et;
		fileName = fn;
	}
	string getError()
	{
		return errorText;
	}
	string getFileName()
	{
		return fileName;
	}

};

void main()
{
	string filename = "d:\\data.txt";
	vector<int> v;
	try{
		readData(filename,v);}
	catch(exception & e)
	{
		cout<<"Error: "<<e.what()<<endl;
		
	}
	

	for(int i =0;i<v.size();i++)
		cout<<v[i]<<endl;
}

void readData(const string & filename, vector<int> & dest)
{
	ifstream instream;
	int tmp;
	instream.open(filename.c_str());
	if (instream.fail())
	{throw exception();}
	while(instream>>tmp)
	{
		dest.push_back(tmp);
	}
	instream.close();
}
